﻿using Android.App;
using Android.Content.PM;
using Android.OS;
using Android.Views;

namespace ZiChen.SoXunLeiPan
{
    [Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, LaunchMode = LaunchMode.SingleTop, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
    public class MainActivity : MauiAppCompatActivity
    {
        override protected void OnCreate(Bundle savedInstanceState)
        {
            // 设置状态栏透明且可见
            if (Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat)
            {
                var window = Window;

                // 移除全屏标志（这是状态栏消失的主要原因）
                window.ClearFlags(WindowManagerFlags.Fullscreen);

                // 允许窗口内容延伸到状态栏区域（但不隐藏状态栏）
                window.AddFlags(WindowManagerFlags.LayoutNoLimits);
                window.ClearFlags(WindowManagerFlags.TranslucentStatus);

                // 设置状态栏为透明
                window.SetStatusBarColor(Android.Graphics.Color.Transparent);
                // 可选：设置导航栏颜色（如果需要）
                window.SetNavigationBarColor(Android.Graphics.Color.White);
                
            }

            base.OnCreate(savedInstanceState);
        }
    }
}
